﻿class awsParamCollection{
	
	private var requestParams:Array = new Array();
	private var cartItemsCount:Number;
	
	public function awsParamColletction(){
		cartItemsCount = 0;
	}
	
	public function toURL() {
		var returnString:String = "";
		for(var i in requestParams){
			trace(i +": "+requestParams[i]); 
			returnString +="&"+i+"="+requestParams[i];
		}
		return returnString;
	}
	//////////////////////////////////////////
	/*         Required Parameters          */
	//////////////////////////////////////////

	//You can register for an Access Key ID from the Amazon Web site if you do 
	//not have one. Every ECS 4.0 request must contain either an Access Key ID 
	//or a Subscription ID but not both.
	public function setAWSAccessKeyId(AWSAccessKeyId:String){
		requestParams["AWSAccessKeyId"] = AWSAccessKeyId;
	}
	
	//Every ECS 4.0 request must contain either an Access Key ID or a 
	//Subscription ID but not both. Starting with version 2006-06-28, ECS 
	//stopped distributing Subscription IDs. If you already have one, it will 
	//continue to work.
	public function setSubscriptionId(SubscriptionId:String){
		requestParams["SubscriptionId"] = SubscriptionId;
	}
	
	//////////////////////////////////////////
	/*          General Parameters          */
	//////////////////////////////////////////
	
	//reserved for future use.
	public function setMarketPlace(){};
	
	//Use the AssociateTag parameter to specify your Associate ID. The 
	//AssociateTag allows product URLs returned by ECS to be tagged as 
	//originating from your Associates Web site. Be sure to specify the tag 
	//value correctly, as no error is generated for incorrect tag values. If 
	//you use those product URLs to link to Amazon, the Associate account 
	//connected to the AssociateTag you specify will be credited for traffic 
	//and items sold through your links. Since you do not need to be an 
	//Associate to use ECS, AssociateTag is not a required parameter. If you do 
	//not include AssociateTag in your requests, a default Associate tag will 
	//be embedded in the product URLs in ECS responses.
	public function setAssociateTag(AssociateTag:String){
		requestParams["AssociateTag"] = AssociateTag;
	}
	
	//an alphanumeric identity assigned by Amazon to a merchant
	public function setMerchantId(MerchantId:String){
		requestParams["MerchantId"] =  MerchantId;
	}
	
	//Response Group
	public function setResponseGroup(ResponseGroup:String){
		requestParams["ResponseGroup"] = ResponseGroup;
	}
	
	//This parameter is optional, The default is 2005-10-05. If you want 
	//another version, including the latest, you must specify it in your request.
	public function setVersion(Version:String){
		requestParams["Version"] = Version;
	}
	
	//////////////////////////////////////////
	/*      BrowseNodeLookup Operation      */
	//////////////////////////////////////////
	
	//The BrowseNodeId parameter specifies the browse node ID of the category 
	//that you want to retrieve information about.
	public function setBrowseNodeId(BrowseNodeId:String){
		requestParams["BrowseNodeId"] = BrowseNodeId;
	}
	
	//////////////////////////////////////////
	/*           Cart  Operations           */
	//////////////////////////////////////////
	
	//The CartId is a unique identifier for an Amazon remote shopping cart. 
	//CartIds are initially obtained by using the CartCreate operation.
	public function setCartId(CartId:String){
		requestParams["CartId"] = CartId;
	}
	
	//The HMAC is a unique security token that, when used with the CartId, 
	//allows you to access and modify (add to, remove from, empty) a specific 
	//remote shopping cart that you have created from your application or Web 
	//site. HMACs are initially obtained by using the CartCreate operation.
	//Any plus signs ("+") embedded in the HMAC must be encoded as %2B for REST.
	public function setHMAC(HMAC:String){
		requestParams["HMAC"] = HMAC;
	}
	
	//The Item parameter in a REST request serves as a means of prefixing one 
	//or more products (Item.1.ASIN) and the quantities of those products 
	//(Item.1.Quantity).
	//To Do: figure out what the ListItemID thing is
	public function addCartItem(ASIN:String,Quantity:String,OfferListingID:String,ListItemId:String){
		cartItemsCount++;
		if(ASIN != "" || ASIN != undefined || ASIN != null)
			requestParams["Item."+cartItemsCount+".ASIN"] = ASIN;
		else if(OfferListingID !="" || OfferListingID != undefined || OfferListingID != null)
			requestParams["Item."+cartItemsCount+".OfferListingID"] = OfferListingID;
		
		if(ListItemId != "" || ListItemId != undefined || ListItemId != null)
			requestParams["Item."+cartItemsCount+".ListItemId"] = ListItemId;
		
		requestParams["Items"+cartItemsCount+".Quantity"] = Quantity;
	}
	
	//MergeCart is a boolean value that determines, in the US locale only, 
	//whether items in the remote shopping cart are added to the customer's 
	//local, Amazon shopping cart (MergeCart=True) or not (MergeCart=False). 
	//If MergeCart is True, when the customer clicks the Purchase button, they
	//are sent to the page that shows the contents of their shopping cart, 
	//which includes all items in their local shopping cart. When MergeCart	is
	//False, when the customer clicks the Purchase button, they are sent to the
	//order pipeline and the purchase pages. The default value is False and for
	//non-US locales it is always False.
	public function setMergeCart(MergeCart:Boolean){
		requestParams["MergeCart"] = (MergeCart)?"True":"False";
	}

	public function modifyCartItem(CartItemId:String,Action:String,Quantity:String,ListItemId:String){
		cartItemsCount++;
		requestParams["Item."+cartItemsCount+".CartItemId"] = CartItemId;
		if(Quantity != "" || Quantity != undefined || Quantity != null)
			requestParams["Item."+cartItemsCount+".Quantity"] = Quantity;
		if(Action != "" || Action != undefined || Action != null)
			requestParams["Item."+cartItemsCount+".Action"] = Action;
		if(ListItemId != "" || ListItemId != undefined || ListItemId != null)
			requestParams["Item."+cartItemsCount+".ListItemId"] = ListItemId;
	}
	
	//////////////////////////////////////////
	/*     CustomerContent  Operations      */
	//////////////////////////////////////////
	
	//Use the CustomerId parameter to specify the customer you want information 
	//about. A CustomerContentLookup request may contain only one CustomerId. 
	//If you do not know the customer ID, you can use the CustomerContentSearch
	// operation to get it.
	public function setCustomerId(CustomerId:String){
		requestParams["CustomerId"] = CustomerId;
	}
	
	//The ReviewPage parameter allows you to page through a specified customer's
	//reviews, ten at a time. The value of this parameter is the page number to
	//be returned. The ReviewPage parameter will be ignored if the CustomerReviews
	//response group is not designated in the request. If you do not include 
	//ReviewPage in your request, the first page (with the first ten reviews, 
	//or all of the reviews if there are fewer than 10 available) are returned 
	//by default.
	public function setReviewPage(ReviewPage:String){
		requestParams["ReviewPage"] = ReviewPage;
	}
	
	
	//The Email parameter allows you to search for a customer by email address. 
	//Search for a customer by email address if you do not have the customer's 
	//name.
	public function setEmail(Email:String){
		requestParams["Email"] = Email;
	}
	
	//The CustomerPage parameter allows you to page through the list of 
	//customers in the response, 20 at a time. This parameter specifies the 
	//number of the page that will be returned by the request. If you do not 
	//include CustomerPage in your request, the first page (containing the first
	//20 customers, or all customers if the search result returns less than 20 
	//customers) is returned by default.
	public function setCustomerPage(CustomerPage:String){
		requestParams["CustomerPage"] = CustomerPage;
	}
	
	//////////////////////////////////////////
	/*           Item  Operations           */
	//////////////////////////////////////////
	
	//Product(s) you would like information about. You may specify up to ten 
	//IDs using a comma-separated list (REST) or multiple elements (SOAP). By 
	//default the item IDs are assumed to be ASINs, unless you specify the 
	//IdType parameter.
	public function setItemId(ItemId:String){
		this.requestParams["ItemId"] = ItemId;
	}
	
	//Type of product ID you are requesting information about.
	//SKU requires a MerchantId. US only.
	//UPC is US only.
	//EAN is the same as JAN (Japanese article number), so you may use this 
	//parameter to look up items by JAN or EAN. DE/JP/CA only.
	//If you select SKU, UPC, or EAN as the IdType for your request, you also 
	//need to include the SearchIndex parameter.
	public function setIdType(IdType:String){
		requestParams["IdType"] = IdType;
	}
	
	//The Amazon store to search.	 
	//Do not use this parameter with ASIN searches; an error will be returned.
	//SearchIndex is required any time you select SKU, UPC, or EAN as the IdType 
	//for your request. The list of available SearchIndex values, segmented by 
	//locale, can be found on the search index values page.
	//If IdType is set to EAN, SearchIndex is restricted to a select group of 
	//values by locale (Amazon.de and Amazon.co.jp).
	public function setSearchIndex(SearchIndex:String){
		requestParams["SearchIndex"] = SearchIndex;
	}
	
	//Filter the offers returned in the product list by condition type.
	public function setCondition(Condition:String){
		requestParams["Condition"] = Condition;
	}
	
	//US only. Filter offers returned in the product list by delivery method. 
	//Valid values are Ship and ISPU (In-store pickup). If you use ISPU, the 
	//ISPUPostalCode parameter must be included to complete the request.
	public function setDeliveryMethod(DeliveryMethod:String){
		requestParams["DeliveryMethod"] = DeliveryMethod;
	}
	
	//US only. If DeliveryMethod is set to ISPU, ISPUPostalCode must specify 
	//the postal code where in store pickup is requested.
	public function setISPUPostalCode(ISPUPostalCode:String){
		requestParams["ISPUPostalCode"] = ISPUPostalCode;
	}
	
	//ItemLookup returns up to 10 offer results at a time. If you do not 
	//include OfferPage in your request, the first page (the first 10 offers or
	//all of the offers if there are less than 10 available) are returned by 
	//default. If included, this parameter specifies what page of results to 
	//include where 1 indicates the first ten results, 2 indicates the the 
	//eleventh through twentieth result, etc.
	public function setOfferPage(OfferPage:String){
		requestParams["OfferPage"] = OfferPage;
	}
	
	//ItemLookup returns all of the variations for a product. You can optionally 
	//include the VariationPage in your request to return 10 variations at a 
	//time where 1 indicates the first ten results, 2 indicates the the eleventh 
	//through twentieth result, etc.
	public function setVariationPage(VariationPage:String){
		requestParams["VariationPage"] = VariationPage;
	}
	
	//The Availability parameter enables ItemSearch to return only those items that 
	//are available. This parameter must be used in combination with MerchantId 
	//and Condition. For more information, see the discussion below this table.
	public function setAvailibility(Availibility:String){
		requestParams["Availibility"] = Availibility;
	}
	
	//Use the Keywords parameter to refine your item search based on specific words 
	//or phrases. Amazone E-Commerce Service (ECS) will match the word or phrase 
	//you include in your request against various product fields, including product title, 
	//author, artist, description, manufacturer, etc.
	//When SearchIndex equals MusicTracks, the Keyword parameter enables you to search
	//by song title. 
	public function setKeywords(Keywords:String){
		requestParams["Keywords"] = Keywords;
	}
	
	//Use the Title parameter when you want to query against product titles only. You may 
	//use all or part of a title in your query.
	public function setTItle(Title:String){
		requestParams["Title"] = Title;
	}
	
	//Use the Power parameter to perform book searches using a complex query string.
	//Please see this page on Amazon for more information about power search: 
	//http://www. amazon.com/exec/obidos/ats-query-page#powersearch.
	public function setPower(Power:String){
		requestParams["Power"] = Power;
	}
	
	//Use the BrowseNode parameter to narrow your search to a specific category of products 
	//in the Amazon catalog. The BrowseNode parameter may contain the ID of any Amazon 
	//browse node. For a list of Amazon browse nodes, please see Browse Node Values.
	public function setBrowseNode(BrowseNode:String){
		requestParams["BrowseNode"] = BrowseNode;
	}
	
	//Use the Artist parameter refine your search by artist name. You may use 
	//all or part of an artist's name in your query. 
	public function setArtist(Artist:String){
		requestParams["Artist"] = Artist;
	}
	
	//Use the Author parameter to refine your search by author name. You may 
	//use all or part of an author's name in your query.
	public function setAuthor(Author:String){
		requestParams["Author"] = Author;
	}
	
	//Use the Actor parameter to refine your search by actor name. You may use 
	//all or part of an actor's name in your query.
	public function setActor(Actor:String){
		requestParams["Actor"] = Actor;
	}
	
	//Use the Director parameter to refine your search by Director name. You 
	//may use all or part of a director's name in your query.
	public function setDirector(Director:String){
		requestParams["Director"] = Director;
	}
	
	//Use the AudienceRating parameter to filter movie product search results 
	//by the expected audience maturity level. Amazon.com values are based upon 
	//MPAA (Motion Picture Association of America) ratings. Amazon.de values 
	//are based upon age. You may specify one or more values in a 
	//comma-separated list in a REST request
	public function setAudienceRating(AudienceRating:String){
		requestParams["AudienceRating"] = AudienceRating;
	}
	
	//Use the Manufacturer parameter to refine your search by manufacturer name. 
	//You may use all or part of a manufacturer's name in your query.
	public function setManufacturer(Manufacturer:String){
		requestParams["Manufacturer"] = Manufacturer;
	}
	
	//Use the MusicLabel parameter to refine your search by the record label 
	//name. You may use all or part of a record label's name in your query.
	public function setMusicLabel(MusicLabel:String){
		requestParams["MusicLabel"] = MusicLabel;
	}
	 	
	//Use the Composer parameter to refine your search by composer name. You 
	//may use all or part of a composer's name in your query.
	public function setComposer(Composer:String){
		requestParams["Composer"] = Composer;
	}

	//Use the Publisher parameter to refine your search by publisher name. You 
	//may use all or part of a publisher's name in your query.
	public function setPublisher(Publisher:String){
		requestParams["Publisher"] = Publisher
	}


	//Use the Brand parameter to refine your search by brand name. You may use 
	//all or part of a brand's name in your query.
	public function setBrand(Brand:String){
		requestParams["Brand"] = Brand
	}

	//Use the Conductor parameter to refine your search by conductor name. You 
	//may use all or part of a conductor's name in your query.
	public function setConductor(Conductor:String){
		requestParams["Conductor"] = Conductor;
	}


	//Use the Orchestra parameter to refine your search by orchestra name. You 
	//may use all or part of an orchestra's name in your query.
	public function setOrchestra(Orchestra:String){
		requestParams["Orchestra"] = Orchestra;
	}

	//In the US locale only, use the TextStream parameter to retrieve product 
	//search results based on a block of text you specify in your request. The 
	//text block could be a search term, a paragraph from a blog, an article 
	//excerpt, or any other text for which you wish to retrieve product matches.
	//Amazon parses out recognized keywords and returns an equal number of 
	//products (ten total) for each recognized keyword. For example, if you 
	//send a request with five recognized keywords, Amazon will return two 
	//products matching each recognized keyword. The ItemPage parameter does 
	//not work when this parameter is being used--only one page can be returned.
	public function setTextStream(TextStream:String){
		requestParams["TextStream"] = TextStream;
	}
	
	//ItemSearch returns up to ten search results at a time. The ItemPage 
	//parameter enables you to a specified page of results. The maximum ItemPage 
	//number that can be returned is 400. An error is returned if you try to 
	//access higher numbered pages. If you do not include ItemPage in your 
	//request, the first page will be returned by default.
	public function setItemPage(ItemPage:String){
		requestParams["ItemPage"] = ItemPage;
	}

	//Use the Sort parameter to specify how your item search results will be 
	//ordered. Please note that valid sort values vary by search index and locale.
	//The full list of sort options are available in Sort Values.
	public function setSort(Sort:String){
		requestParams["Sort"] = Sort;
	}
	
	//Use the City parameter to refine your restaurant search by city name. You 
	//may use all or part of a city's name in your query. At the present time, 
	//ECS return restaurants for only select cities (see Valid Values). This 
	//parameter may be used only when SearchIndex equals Restaurant and is only 
	//applicable to US requests.
	public function setCity(City:String){
		requestParams["City"] = City;
	}

	//Use the Cuisine parameter to refine your restaurant search by cuisine 
	//name (i.e., Chinese, Italian, American, etc.). You may use all or part of 
	//a cuisine's name in your query. This parameter may be used only when 
	//SearchIndex equals Restaurant and is only applicable to US requests.
	public function setCuisine(Cuisine:String){
		requestParams["Cuisine"] = Cuisine;
	}

	//Use the Neighborhood parameter to refine your restaurant search by 
	//neighborhood name (i.e., Capitol Hill, Arlington, North Beach, etc.). 
	//You may use all or part of a neighborhood's name in your query. This 
	//parameter may be used only when SearchIndex equals Restaurant and is only 
	//applicable to US requests.
	public function setNeighborhood(Neighborhood:String){
		requestParams["Neighborhood"] = Neighborhood;
	}

	//Use the MinimumPrice parameter to set a lower price bound on products 
	//returned by ItemSearch. The MinimumPrice value must be specified in 
	//pennies (or equivalent in local currency).
	public function setMinimumPrice(MinimumPrice:String){
		requestParams["MinimumPrice"] = MinimumPrice;
	}

	//Use the MaximumPrice parameter to set an upper price bound on products 
	//returned by ItemSearch. The MaximumPrice value must be specified in pennies 
	//(or equivalent in local currency).
	public function setMaximumPrice(MaximumPrice){
		requestParams["MaximumPrice"] = MaximumPrice;
	}
	
	
	//////////////////////////////////////////
	/*           List Operations            */
	//////////////////////////////////////////
	
	//Use the ListType parameter to specify the type of list you want to 
	//retrieve. Valid values are Listmania and WishList.
	public function setListType(ListType:String){
		requestParams["ListType"] = ListType;
	}
	
	//Use the ListId parameter to identify the list you would like to retrieve. 
	//Every list has a unique list ID. You may only look up one list at a time.
	public function setListId(ListId:String){
		requestParams["ListId"] = ListId;
	}
	
	//The ProductPage parameter allows you to paginate the list of products 
	//returned by ListLookup. When you use ProductPage, ListLookup will return 
	//10 items at a time. The maximum ProductPage number that can be returned 
	//is 30. If you do not include ProductPage in your request, the first 10 
	//items are returned by default.
	public function setPoductPage(ProductPage:String){
		requestParams["ProductPage"] = ProductPage;
	}
	
	//US only. The ProductGroup parameter allows you to filter the list of 
	//products returned by ListLookup by product line.
	//Note:
	//Be sure to properly encode the ProductGroup parameter. For example, 
	//"Lawn & Patio" in REST requests is "Lawn%20%26%20Patio".
	public function setProductGroup(ProductGroup:String){
		requestParams["ProductGroup"] = ProductGroup;
	}
	
	//Use the Name parameter when you want to search for lists by using the 
	//full customer name. 
	public function setName(Name:String){
		requestParams["Name"] = Name; 
	}
	
	//Use the FirstName parameter when you want to search for lists by using a 
	//customer's first name.
	public function setFirstName(FirstName:String){
		requestParams["FirstName"] = FirstName;
	}
	
	//Use the LastName parameter when you want to search for lists by using a 
	//customer's last name. 
	public function setLastName(LastName:String){
		requestParams["LastName"] = LastName;
	}
	
	//The State parameter allows you to search for lists created by customers 
	//living in the state you specify.
	public function setState(State:String){
		requestParams["State"] = State;
	}
	
	//The ListPage parameter allows you to specify which page of results will 
	//be returned by the request. The ListPage parameter allows you page through 
	//lists in the response, 10 at a time. If you do not include ListPage in 
	//your request, the first page of results will be returned, containing all 
	//items if there are less than ten or the first ten items if there are more 
	//than ten.
	public function setListPage(ListPage:String){
		requestParams["ListPage"] = ListPage;
	}
	
	//////////////////////////////////////////
	/*      SellerListing Operations        */
	//////////////////////////////////////////
	
	//Use the Id parameter to specify the exchange ID of the item you wish to 
	//look up.
	public function setId(Id:String){
		requestParams["Id"] = Id;
	}
	
	//The SellerId limits the results to a single seller ID.
	public function setSellerId(SellerId:String){
		requestParams["SellerId"] = SellerId;
	}
	
	//////////////////////////////////////////
	/*       SellerLookup Operations        */
	//////////////////////////////////////////
	
	//This parameter specifies the page number, when multiple "pages" (blocks 
	//of 5 feedback items) exist. The maximum number of pages that can be 
	//returned is 10 (50 feedback items). If you do not include FeedbackPage 
	//in your request, all of the feedback items are returned if there are less 
	//than five, or if there are more than five, the first 5 are returned. 
	public function setFeedbackPage(FeedbackPage:String){
		requestParams["FeedbackPage"] = FeedbackPage;
	}
	
	//////////////////////////////////////////
	/*    SimilarityLookup Operations       */
	//////////////////////////////////////////
	
	//Use the SimilarityType parameter to filter the list of similar products 
	//returned by SimilarityLookup. Note that the SimilarityType parameter is 
	//ignored when when the SimilarityLookup request contains only one ItemId.
	//Set the value of SimilarityType to Intersection if you want the list of 
	//similar products returned by SimilarityLookup to include only products 
	//that are similar to all of the items in the request.
	//Set the value of SimilarityType to Random if you want the list of similar 
	//products returned by SimilarityLookup to include an assortment of similar 
	//products corresponding to any of the items in the request.
	public function setSimilarityType(SimilarityType:String){
		requestParams["SimilarityType"] = SimilarityType;
	}
	
	//////////////////////////////////////////
	/*   TransactionLookup Operations       */
	//////////////////////////////////////////
	
	//Use the TransactionId parameter to specify transaction IDs you want 
	//information about. You may specify up to 10 transaction IDs in a single 
	//request, using a comma-separated list in a REST request or multiple 
	//elements in SOAP.
	public function setTransactionId(TransactionId:String){
		requestParams["TransactionId"] = TransactionId;
	}
	
}